<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
<%@ include file="/interceptor.jsp"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="/struts-tags" prefix="s" %>
<%@page isELIgnored="false" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>垃圾邮件列表</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
	function delemail(id){
		if(confirm("确定要删除吗？")){
			window.location.href = "emaildeleteReal?id="+id+"&isDeleted=0";
		}
	}
	function reductionemail(id){
		if(confirm("确定要还原吗？")){
			window.location.href = "emailreduction?id="+id;
		}
	}
</script>
</head>
<body>
	<div class="action">
		<div class="t">
			垃圾邮件列表
		</div>
		<div class="pages">
			<table width="90%" border="1" cellpadding="0" cellspacing="0" style="border:thin solid #666; margin-top:20px">
            	<tr>
                	<th width="20%">邮件标题</th>
                    <th width="20%">发送人</th>
                    <th width="15%">是否已读</th>
                    <th width="20%">时间</th>
                    <th width="20%">操作</th>
                </tr>
         
         <c:if test="${spamList == null}">
        	 <script type="text/javascript">
				function setit(){
					document.forms[0].submit();
				}
			</script>
         	<form action="emailspam" method="post"/>
    	 </c:if>
          
         <c:if test="${spamList!= null}">
            <c:forEach var="spam" items="${spamList}"> 
				<tr>
                    <td  align="center">${spam.title}</td>
                    <td  align="center">${spam.sender}</td>
                    <td  align="center">
                    	<c:if test ="${spam.isRead==0 }">未读</c:if>
                    	<c:if test ="${spam.isRead==1 }">已读</c:if>
                    </td>
                    <td  align="center">
                    	<fmt:formatDate value="${spam.time }" pattern="yyyy-MM-dd"/>
                    </td>
                    <td  align="center">[<a href="javascript:reductionemail(${spam.id})" style="color:red">还原]</a>|[<a href="javascript:delemail(${spam.id})" style="color:red">删除</a>]</td>
				</tr>
             </c:forEach>
         </c:if>
             </table>			
		</div>
	</div>

</body>
</html>